package com.xjy.headfirst.适配器模式;

import java.util.Enumeration;
import java.util.Iterator;

/**
 * decription: 适配器本质上来说是接口转换为不同的接口
 *
 * @author 辛纪元
 * @since 2022-07-13
 */

public class EnumeratorIterator implements Iterator<Object> {

    Enumeration<Object> enumeration;

    public EnumeratorIterator(Enumeration<Object> enumeration){
        this.enumeration = enumeration;
    }

    @Override
    public boolean hasNext() {
        return enumeration.hasMoreElements();
    }

    @Override
    public Object next() {
        return enumeration.nextElement();
    }

    @Override
    public void remove(){
        throw new UnsupportedOperationException();
    }
}
